package com.huluobo.a2202mvvm_im_douyindemo.db;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.OnConflictStrategy;
import androidx.room.Query;
import androidx.room.Update;

import com.huluobo.a2202mvvm_im_douyindemo.bean.LoginBeanResult;
import com.huluobo.a2202mvvm_im_douyindemo.bean.VideoListBeanResult;

import java.util.List;

import io.reactivex.Observable;

/**
 * Created by LC on 2024/5/8.
 * Dao,主要用于数据库中的某一个表的增删改查
 */
@Dao
public interface UserDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    void insertUserInfo(LoginBeanResult.LoginBean loginBean);

    @Delete
    void deleteUserInfo(LoginBeanResult.LoginBean loginBean);

    @Update
    void updateUserInfo(LoginBeanResult.LoginBean loginBean);

    @Query("select * from user_info")
    List<LoginBeanResult.LoginBean> queryAllUsers();

    @Query("select * from user_info where username=:username")
    Observable<LoginBeanResult.LoginBean> queryUserInfoByName(String username);

}
